package hadoop.mr05;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

public class group extends WritableComparator {
    protected group(){
        super(Phone.class,true);
    }
    // 重写分组方法
    @Override
    public int compare(WritableComparable a, WritableComparable b) {
        Phone p1_state = (Phone) a;
        Phone p2_state = (Phone) b;;
        // 分组规则：只要省份一致则为一组 --> 返回值为0则表示两个值相同
        return p1_state.getState().compareTo(p2_state.getState());
    }
}
